package com.demo.job.elasticjob.lite;

import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.stereotype.Component;

/**
 * 简单调度任务
 * @author cyj
 */
@Slf4j
@Component
public class ElasticJobLiteSimpleJob implements SimpleJob {

    @Override
    public void execute(ShardingContext shardingContext) {
        String jobName = shardingContext.getJobName();
        String jobParameter = shardingContext.getJobParameter();
        String shardingParameter = shardingContext.getShardingParameter();
        int shardingItem = shardingContext.getShardingItem();
        int shardingTotalCount = shardingContext.getShardingTotalCount();

        log.info("jobName:{}, shardingItem:{}, jobParameter:{}, shardingParameter:{}, shardingTotalCount:{}",
                jobName, shardingItem, jobParameter, shardingParameter, shardingTotalCount);
    }
}
